package com.phospherus.test.flow.service

import com.phospherus.flow.service.FormInstService
import com.phospherus.test.BaseTest
import org.hibernate.SQLQuery
import org.hibernate.transform.Transformers
import org.junit.Test
import org.springframework.beans.factory.annotation.Autowired
import javax.persistence.EntityManager


/**
 * @author songjinlong
 * @version 1.0
 * @since 2017/12/26
 */
class FormInstServiceTest : BaseTest() {
    @Autowired
    lateinit var formInstService: FormInstService

    @Autowired
    lateinit var em: EntityManager

    @Test
    fun test() {
        var sql = "select * from org"
        var query = em.createNativeQuery(sql)
        query.unwrap(SQLQuery::class.java).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP)
        var result = query.resultList

        print(result)
    }

}